package com.zs.members.controller;



import com.gsj.common.pojo.R;
import com.zs.members.pojo.vo.CouponHistoryVo;
import com.zs.members.service.CouponHistoryService;
import com.zs.members.pojo.entity.CouponHistory;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
    import org.springframework.web.bind.annotation.RestController;

/**
* <p>
    *  前端控制器
    * </p>
*
* @author 张硕
* @since 2021-07-26
*/

@Slf4j
@Api(tags = "优惠券记录")
@RestController
@RequestMapping("/members/couponHistory")
public class CouponHistoryController {

    @Autowired
    public CouponHistoryService couponHistoryService;

    @ApiOperation(value = "新增")
    @PostMapping("/save")
    public R save(@RequestBody CouponHistory couponHistory){
        couponHistoryService.save(couponHistory);
        return  R.ok();
    }

    @ApiOperation(value = "列表（分页）")
    @PostMapping("/get/{currentPage}/{pageSize}")
    public R get(@PathVariable("currentPage")Long currentPage, @PathVariable("pageSize")Long pageSize,@RequestBody CouponHistoryVo couponHistoryVo){
        return couponHistoryService.get(currentPage,pageSize,couponHistoryVo);
    }

}
